Dynomotion

Group: DynoMotion Message: 1743 From: Troy Date: 8/29/2011
Subject: MACH3 PLUGIN MOTOR SETUP
Hello,

I have gotten a single stepper motor to hooked up to the kflop and it runs amazing. 

Now I am working on getting the Mach3 plugin to work properly.  I have made my, initilization file, and set my motor up in Mach 3.  The motor jogs great and everything seems to be working until I try use the MDI line and g00 rapid my motor.  When I do this the motor screams and misses, if I g01 and incrementally move my motors faster,the motor also stalls out well before it reaches the max velocity set up in motor tuning.  It seems like the kflop is ignoring mach3s motor tuning when it is executing gcode.

What am I missing?    The axis config file has lines for velocity and acceleration, I played around with those a bit and that didn't seem to help.  (do those have any relationship to the mach3 plugin, or is motor setup all done in mach3)

Thanks
Troy
Group: DynoMotion Message: 1744 From: TK Date: 8/29/2011
Subject: Re: MACH3 PLUGIN MOTOR SETUP
Hi Troy,

It sounds like your Mach3 "Motor Tuning" is simply set too high. 

Gcode uses the Mach3 Tuning paramters in units/min etc but continuous Jogging uses the independent axis settings in KMotion which are in steps/sec. Multiply your Mach3 Tuning by the resolution (and also divide velocity by 60 to convert time from per min to per sec) to see if you get similar numbers as in KMotion. Also keep in mind that motion using the KMotion parameters is Jerk limited and smoother so you may be able to achieve a bit higher speed or acceleration. Or furthermore if Jerk is set way too low that may be limiting your acceleration and/or velocity so you are not actually doing the vel/acceleration settings you think you are. To simulate 2nd order motion like Mach3 does set the Jerk to infinity (100X the Acceleration value).

If you continue to have problems post all your settings. 

TK

On Aug 29, 2011, at 2:26 PM, Troy  <groups@...> wrote:

 

Hello,

I have gotten a single stepper motor to hooked up to the kflop and it runs amazing. 

Now I am working on getting the Mach3 plugin to work properly.  I have made my, initilization file, and set my motor up in Mach 3.  The motor jogs great and everything seems to be working until I try use the MDI line and g00 rapid my motor.  When I do this the motor screams and misses, if I g01 and incrementally move my motors faster,the motor also stalls out well before it reaches the max velocity set up in motor tuning.  It seems like the kflop is ignoring mach3s motor tuning when it is executing gcode.

What am I missing?    The axis config file has lines for velocity and acceleration, I played around with those a bit and that didn't seem to help.  (do those have any relationship to the mach3 plugin, or is motor setup all done in mach3)

Thanks
Troy

Group: DynoMotion Message: 1745 From: Troy Date: 8/29/2011
Subject: Re: MACH3 PLUGIN MOTOR SETUP
Hmm,  it seems like there is some interaction between the Mach3 motor tuning and the Kmotion paramaters.

I am confused on"Jogging uses the independent axis settings in KMotion" because when I change mach3 motor tuning paramaters my jog speed changes.  Likewise "Gcode uses the Mach3 Tuning paramters in units/min"  when I change the kmotion paramaters, my gcode speeds change.

So with Mach3 under gcode you can never get as smooth motor control as using just the kmotoion because mach3 is using the mach3 motor settings?  Is there some way that both jogging and gcode can use the same motor settings?



Currently my Mach 3 parameters are:

steps per:  25075.82955  (roughly measured, I don't have the exact specs for my stages)
velocity:   200    this can change depending on what the kmotion paramaters are.
acceleration: 200

I have my drives set to 5000 steps per revolution

Thanks for your help.

Troy


  bellow is my kmotion init file:

#include "KMotionDef.h"

// Defines axis 0 and 1 as simple steppers
// enables them
// sets them as an xy coordinate system for GCode

int main()
{
            ch0->InputMode=NO_INPUT_MODE;
    ch0->OutputMode=STEP_DIR_MODE;
    ch0->Vel=4000000;
    ch0->Accel=1000000;
    ch0->Jerk=10000000000;        //trying to simulate 2nd order motion to match mach3
    ch0->P=1;
    ch0->I=0;
    ch0->D=0;
    ch0->FFAccel=0;
    ch0->FFVel=0;
    ch0->MaxI=200;
    ch0->MaxErr=200;
    ch0->MaxOutput=200;
    ch0->DeadBandGain=1;
    ch0->DeadBandRange=0;
    ch0->InputChan0=0;
    ch0->InputChan1=1;
    ch0->OutputChan0=0;
    ch0->OutputChan1=1;
    ch0->MasterAxis=-1;
    ch0->LimitSwitchOptions=0x0;
    ch0->InputGain0=1;
    ch0->InputGain1=1;
    ch0->InputOffset0=0;
    ch0->InputOffset1=0;
    ch0->OutputGain=1;
    ch0->OutputOffset=0;
    ch0->SlaveGain=1;
    ch0->BacklashMode=BACKLASH_OFF;
    ch0->BacklashAmount=0;
    ch0->BacklashRate=0;
    ch0->invDistPerCycle=1;
    ch0->Lead=0;
    ch0->MaxFollowingError=1000000000;
    ch0->StepperAmplitude=250;

    ch0->iir[0].B0=1;
    ch0->iir[0].B1=0;
    ch0->iir[0].B2=0;
    ch0->iir[0].A1=0;
    ch0->iir[0].A2=0;

    ch0->iir[1].B0=1;
    ch0->iir[1].B1=0;
    ch0->iir[1].B2=0;
    ch0->iir[1].A1=0;
    ch0->iir[1].A2=0;

    ch0->iir[2].B0=1;
    ch0->iir[2].B1=0;
    ch0->iir[2].B2=0;
    ch0->iir[2].A1=0;
    ch0->iir[2].A2=0;


    EnableAxisDest(2,0);

    DefineCoordSystem(0,1,-1,-1);

    return 0;
}






Group: DynoMotion Message: 1746 From: Tom Kerekes Date: 8/29/2011
Subject: Re: MACH3 PLUGIN MOTOR SETUP
Hi Troy,
 
BTW I assume you are using Stepper Motors with a microstepping drive of 25 uSteps/step?  Also I assume your Mach3 units are inches?
 
Actually you are correct.  I forgot the Mach3 cont. jog speed is set as a percentage of the Max Motor Tuning Speed.  Only the acceleration and Jerk of the Jogging are set in KMotion.
 
I don't see how KMotion Motion Profile Parameters would affect Mach3 GCode though.
 
The parameters are separate for a reason as they are two different motion techniques (2nd order vs 3rd order) that may possibly require significantly different settings.  But it is confusing I'll admit.  It makes more sense for KMotionCNC which does 3rd order Rapids and Jogs.
 
But hey it looks like your KMotion velocity is way too high at 4,000,000 steps/sec.  This would be 12000RPM if your motors are 5000 steps/rev.  Besides the max pulse rate of KFLOP is only 2,500,000 steps/sec and only to 250,000 steps/sec if you don't reduce the pulse length setting.  That also comes out to almost 10,000ipm.  I don't see how these settings can be working on the KMotion Step Response Screen unless you are only moving tiny distances where we can't get up to speed.
 
 
In Mach3 the max velocity of 200ipm is probably reasonable.  That would be
 
200ipm / 60sec per min x 25000 steps/in = 83,333 steps/sec
 
But the acceleration of 200 in/sec3 is probably way too high.  that is over 1/2 G
 
 
Try testing the motion in the KMotion Step Response Screen again using more reasonable values and with moves large enough to get up to full speed.  There is also a plot mode that shows velocity.  Then convert the numbers to Inches, seconds, minutes for Mach3.
 
The Init.c program also has problems.  It is only configuring one axis channel 0, but then it enables axis channel 2, and then defines a 2 axes system of channels 0 and 1.
 
Hang in there - we'll get it eventually :}
 
Regards
TK 
 
 
 


--- On Mon, 8/29/11, Troy <groups@...> wrote:

From: Troy <groups@...>
Subject: Re: [DynoMotion] MACH3 PLUGIN MOTOR SETUP
To: DynoMotion@yahoogroups.com
Date: Monday, August 29, 2011, 3:48 PM

 
Hmm,  it seems like there is some interaction between the Mach3 motor tuning and the Kmotion paramaters.

I am confused on"Jogging uses the independent axis settings in KMotion" because when I change mach3 motor tuning paramaters my jog speed changes.  Likewise "Gcode uses the Mach3 Tuning paramters in units/min"  when I change the kmotion paramaters, my gcode speeds change.

So with Mach3 under gcode you can never get as smooth motor control as using just the kmotoion because mach3 is using the mach3 motor settings?  Is there some way that both jogging and gcode can use the same motor settings?



Currently my Mach 3 parameters are:

steps per:  25075.82955  (roughly measured, I don't have the exact specs for my stages)
velocity:   200    this can change depending on what the kmotion paramaters are.
acceleration: 200

I have my drives set to 5000 steps per revolution

Thanks for your help.

Troy


  bellow is my kmotion init file:

#include "KMotionDef.h"

// Defines axis 0 and 1 as simple steppers
// enables them
// sets them as an xy coordinate system for GCode

int main()
{
            ch0->InputMode=NO_INPUT_MODE;
    ch0->OutputMode=STEP_DIR_MODE;
    ch0->Vel=4000000;
    ch0->Accel=1000000;
    ch0->Jerk=10000000000;        //trying to simulate 2nd order motion to match mach3
    ch0->P=1;
    ch0->I=0;
    ch0->D=0;
    ch0->FFAccel=0;
    ch0->FFVel=0;
    ch0->MaxI=200;
    ch0->MaxErr=200;
    ch0->MaxOutput=200;
    ch0->DeadBandGain=1;
    ch0->DeadBandRange=0;
    ch0->InputChan0=0;
    ch0->InputChan1=1;
    ch0->OutputChan0=0;
    ch0->OutputChan1=1;
    ch0->MasterAxis=-1;
    ch0->LimitSwitchOptions=0x0;
    ch0->InputGain0=1;
    ch0->InputGain1=1;
    ch0->InputOffset0=0;
    ch0->InputOffset1=0;
    ch0->OutputGain=1;
    ch0->OutputOffset=0;
    ch0->SlaveGain=1;
    ch0->BacklashMode=BACKLASH_OFF;
    ch0->BacklashAmount=0;
    ch0->BacklashRate=0;
    ch0->invDistPerCycle=1;
    ch0->Lead=0;
    ch0->MaxFollowingError=1000000000;
    ch0->StepperAmplitude=250;

    ch0->iir[0].B0=1;
    ch0->iir[0].B1=0;
    ch0->iir[0].B2=0;
    ch0->iir[0].A1=0;
    ch0->iir[0].A2=0;

    ch0->iir[1].B0=1;
    ch0->iir[1].B1=0;
    ch0->iir[1].B2=0;
    ch0->iir[1].A1=0;
    ch0->iir[1].A2=0;

    ch0->iir[2].B0=1;
    ch0->iir[2].B1=0;
    ch0->iir[2].B2=0;
    ch0->iir[2].A1=0;
    ch0->iir[2].A2=0;


    EnableAxisDest(2,0);

    DefineCoordSystem(0,1,-1,-1);

    return 0;
}






Group: DynoMotion Message: 1752 From: Troy Date: 8/29/2011
Subject: Re: MACH3 PLUGIN MOTOR SETUP
Ok, I think I got it

Mach 3 settings:

Steps Per rev:  25075
Velocity (in/min): 300 = 125375 (steps/sec)
Acceleration (in/min): 150=3761250 (steps/sec)

Kflop settings:

velocity (steps/sec) : 125375
Acceleration (steps/sec): 3761250
Jitter:  10000000000    // effectively disabled 


With using Jitter I was able to get much higher rapid speeds.
velocity (steps/sec):200182
acceleration (steps/sec):4012000
jitter:  1.0e8        

Just to see if I have it correct in my mind: with jitter on I can increase my jogging speed because mach3 is using the jitter variable but it will not increase my g00 rapid speeds because it is not using the 3rd order kmotion variables.

If this were the case it seems it would be nice if mach3 could use the 3rd order variables for rapids the same as it does for jogging and use 2nd order for cutting.
Minus that, things would be far less confusing and simple to set up if the mach3 plugin used the same 2nd order mach3 motor tuning variables for jogging the same way it does for cutting.  It seems that is basically what I had to do: make the kmotion variables match the 2nd order variables in Mach3.  Am I correct in that thinking or is there some reason I would want the jog speeds not to match the rapid speed.

It also sounds like if I want things to move faster I need to use kmotioncnc, but then I don't get all the bells and whistles of mach3.


Thanks for walking me through it all.





 

Group: DynoMotion Message: 1756 From: Tom Kerekes Date: 8/29/2011
Subject: Re: MACH3 PLUGIN MOTOR SETUP
Hi Troy,
 
Sounds like we are basically on the same page.
 
2nd order motion has unlimited Jerk so that is the equivalent to slamming on the gas and slamming on the brakes in a car.  It is "jerky".  With 3rd order motion the gas and the brakes are applied more gradually (ramped) so there is less jerk and disturbance.  Realize that it does take more time to stop if the brakes are applied gradually.  However it is usually a net win to brake slowly but harder and come to a stop quicker with less shock and disturbance (that may cause a miss-step or other problem).
 
Mach3 just tells us (the plugin) to Jog at a certain speed so we are free to accelerate however we wish.  But for Rapids Mach3 generates point by point motion that we have little choice other than to just execute as given.
 
You may set the higher performance Jerk limited settings in KMotion.  The idea of unlimited Jerk was just to test motions of the type Mach would sometime do.  It this case you should get the higher and smoother acceleration when Jogging in Mach3.  Unfortunately you will still be limited to jog at 100% of the Motor Tuning Setting.  It hadn't really occurred to me that the Rapid Speed and Jog Speed are tied together in Mach3.  If you increased your Motor Tuning Speed so you could then Jog faster, then Rapids would likely stall.   I do see there is a Rapid - FeedRate - Override on the Mach3 screen.  So I suppose it would be possible to increase your Motor Tuning speed and then carefully always keep the Rapid Override at some value less than 100% to allow faster jogging.  But it seems dangerous and awkward.
 
TK 
 
 
 
 


--- On Mon, 8/29/11, Troy <groups@...> wrote:

From: Troy <groups@...>
Subject: Re: [DynoMotion] MACH3 PLUGIN MOTOR SETUP
To: DynoMotion@yahoogroups.com
Date: Monday, August 29, 2011, 6:46 PM

 
Ok, I think I got it

Mach 3 settings:

Steps Per rev:  25075
Velocity (in/min): 300 = 125375 (steps/sec)
Acceleration (in/min): 150=3761250 (steps/sec)

Kflop settings:

velocity (steps/sec) : 125375
Acceleration (steps/sec): 3761250
Jitter:  10000000000    // effectively disabled 


With using Jitter I was able to get much higher rapid speeds.
velocity (steps/sec):200182
acceleration (steps/sec):4012000
jitter:  1.0e8        

Just to see if I have it correct in my mind: with jitter on I can increase my jogging speed because mach3 is using the jitter variable but it will not increase my g00 rapid speeds because it is not using the 3rd order kmotion variables.

If this were the case it seems it would be nice if mach3 could use the 3rd order variables for rapids the same as it does for jogging and use 2nd order for cutting.
Minus that, things would be far less confusing and simple to set up if the mach3 plugin used the same 2nd order mach3 motor tuning variables for jogging the same way it does for cutting.  It seems that is basically what I had to do: make the kmotion variables match the 2nd order variables in Mach3.  Am I correct in that thinking or is there some reason I would want the jog speeds not to match the rapid speed.

It also sounds like if I want things to move faster I need to use kmotioncnc, but then I don't get all the bells and whistles of mach3.


Thanks for walking me through it all.